<template>
  <div>
    <w-nav-bar
      title="意见列表"/>
    <w-cell
      v-for="(v, k) in loadListModel.dataArr"
      :key="k"
      @click="cellClick(v)"
      :title="v.name"
      :content="v.content"
      :footer="v.dateStr"/>
    <w-menu-btn
      :add-router="{ name: 'SetAdviceAdd' }"
      :dustbin-router="{ name: 'SetAdviceDustbin' }"
      :dustbin="isLogin"/>
    <w-load-more :load-model="loadListModel"/>
  </div>
</template>

<script>
  import YBListLoad from '@/models/YBListLoad.js'
  import FeedBackModel from '@/models/web/FeedBackModel'
  import { mapGetters } from 'vuex'
  import API from '@/api/apis'
  import WCell from '@/components/mobile/cell/00'
  import WMenuBtn from '../../../com/menu-btn/00'
  import WLoadMore from '@/components/global/loadMore/index'

  export default {
    name: 'MeAdviceList',
    components: {
      WCell,
      WMenuBtn,
      WLoadMore
    },
    data() {
      return {
        /**
         * 列表加载模型
         */
        loadListModel: new YBListLoad (FeedBackModel)
      }
    },
    computed: {
      ...mapGetters (['isLogin'])
    },
    methods: {
      /**
       * cell 点击
       * @param v 反馈模型
       */
      cellClick(v) {
        if (this.isLogin) {
          this.$router.push ({name: 'SetAdviceDetail', query: {id: v._id}})
        }
      }
    },
    mounted() {
      FeedBackModel.listUrl = this.isLogin ? API.feedback.allAuth: API.feedback.all
    }
  }
</script>

<style lang="scss" scoped>

</style>

